<?php 
    parse_str($argv[1], $_GET);

    $input = "";
    # Security risk, leave commented out for now.
    # if (isset($_GET['input'])) {
    #    $input = $_GET['input'];
    # } 

    $cmd = "/usr/bin/pstree -p $input"; 

    # Unused for now.
    # $option = "";
    # if (isset($_GET['option'])) { 
    #	$option = "checked";
    #	$cmd  .= " ";
    # }

    # need this line for each option selected.
    # <input type="checkbox" name="option" <x echo "$option"; x> >
?>

<STYLE TYPE="text/css">
<!--
TD { padding: 0; spacing: 0: height: 0; font-family: monospace; white-space: pre; }
TR { padding: 0; spacing: 0: height: 0; font-family: monospace; white-space: pre; }
--->
</STYLE>

<CENTER>
<table width='100%' border=0 cellspacing=0 cellpadding=0>

<?
   
    # This could have just been a Type= and command.
    # It is a php program in the hopes that one day.
    # we will use the pid to hyperlink to a kill screen.

    $pfh = popen("$cmd", "r");
    while ( !feof($pfh) ) {
	$line = fgets($pfh); 
	$line = rtrim($line);
        print " <tr>\n  <td>$line</td>\n </tr>\n";
    }
    pclose($pfh);

?>

</table>
</CENTER>
